package org.mcflier.appuntamento.core.modules;

import java.util.HashMap;
import java.util.Map;

public class ModuleNode {
	
	private Map<String, String> attributes;
	private Map<String, ModuleNode> nodes;
	private String name;
	
	public ModuleNode(String name){
		this.name = name;
		this.attributes = new HashMap<String, String>();
		this.nodes = new HashMap<String, ModuleNode>();
	}
	
	public String getName(){
		return this.name;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public void add(String key, String value){
		if(key == null)
			throw new NullPointerException("Key attribute must not be null");
		
		this.attributes.put(key, value);
	}
	
	public void add(String key, ModuleNode node){
		if(key == null)
			throw new NullPointerException("Key module content must not be null");
		
		this.nodes.put(key, node);
	}
	
	public String getAttribute(String key){
		return this.attributes.get(key);
	}
	
	public Map<String, String> getAttributes(){
		return this.attributes;
	}
	
	public ModuleNode getNode(String key){
		return this.nodes.get(key);
	}
	
	public Map<String, ModuleNode> getNodes(){
		return this.nodes;
	}
}
